package com.seckill.util;

import org.apache.commons.lang3.StringUtils;

import java.util.regex.Pattern;

/**
 * @author yangjunwei
 * @date 2021/10/29 4:48 下午
 */
public class ValidatorUtil {

    /**
     * 正则表达式验证手机号
     */
    private static final Pattern MOBILE_PATTERN = Pattern.compile("1\\d{10}");

    public static boolean isMobile(String src) {
        if (StringUtils.isEmpty(src)) {
            return false;
        }
        return MOBILE_PATTERN.matcher(src).matches();
    }

    public static void main(String[] args) {
        System.out.println(isMobile("18912341234"));
        System.out.println(isMobile("1891234123"));
        System.out.println(isMobile("28912341234"));
    }


}
